﻿#include "mainwindow.h"
#include "dialoglogin.h"
#include "dialoginiprogram.h"
#include "chatwindow.h"
#include <QApplication>
#include "Business/businessinit.h"
#include <thread>
DialogIniProgram* iniProgram;
DialogLogin* login;
MainWindow* mainWindow;

#ifndef UNITTEST

int main(int argc, char *argv[])
{
    BusinessInit& instance = BusinessInit::getInstance();
    if (!instance.InitModules()) {
        return 0;
    }

    QApplication application(argc, argv);
    QApplication::setQuitOnLastWindowClosed(true);


    iniProgram = new DialogIniProgram();
    iniProgram->app = &application;

    QObject::connect(iniProgram, &DialogIniProgram::closeProgram, &application, &QApplication::quit);
    iniProgram -> show();

    return application.exec();
}

#else
#include "chatwindow.h"

int main(int argc, char *argv[]) {
    QApplication app(argc, argv);
    ChatWindow window;
    window.setWindow("测试图片");
    window.newChat(1, "测试超长文本：QListWidget是一个方便的类，它提供了一个类似于QListView提供的列表视图，但是具有一个经典的基于项目的接口，用于添加和删除项目。QListWidget使用一个内部模型来管理列表中的每个QListWidgetItem。", "2024-4-12 13:06");
    window.newChat(1, "添加图片", "2024-4-12 13:06");
    window.show();
    window.newPicture(1, "C:/Users/ghost/Desktop/cover.jpg", "2024.4.12");
    return app.exec();
}


#endif
